package kr.co.handysoft.project.smartPolice.composite.detail;

import kr.co.handysoft.project.smartPolice.dialog.ImageViewDialog;

import org.eclipse.swt.SWT;
import org.eclipse.swt.custom.SashForm;
import org.eclipse.swt.events.MouseAdapter;
import org.eclipse.swt.events.MouseEvent;
import org.eclipse.swt.layout.FormAttachment;
import org.eclipse.swt.layout.FormData;
import org.eclipse.swt.layout.FormLayout;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Table;
import org.eclipse.swt.widgets.TableColumn;
import org.eclipse.swt.widgets.TableItem;
import org.eclipse.swt.widgets.Tree;
import org.eclipse.swt.widgets.TreeItem;
import org.eclipse.wb.swt.SWTResourceManager;

public class DetailStatusDirectoryInformationComposite extends Composite {
	private Table table;

	/**
	 * Create the composite.
	 * @param parent
	 * @param style
	 */
	public DetailStatusDirectoryInformationComposite(final Composite parent,
			int style) {
		super(parent, style);
		setBackground(SWTResourceManager.getColor(SWT.COLOR_TITLE_INACTIVE_BACKGROUND_GRADIENT));
		setLayout(new FormLayout());
		
		SashForm sashForm = new SashForm(this, SWT.NONE);
		sashForm.setBackground(SWTResourceManager.getColor(SWT.COLOR_TITLE_INACTIVE_BACKGROUND_GRADIENT));
		FormData fd_sashForm = new FormData();
		fd_sashForm.bottom = new FormAttachment(100, -2);
		fd_sashForm.right = new FormAttachment(100, -2);
		fd_sashForm.top = new FormAttachment(0, 2);
		fd_sashForm.left = new FormAttachment(0, 2);
		sashForm.setLayoutData(fd_sashForm);
		
		Tree tree = new Tree(sashForm, SWT.BORDER);
		
		TreeItem trtmNewTreeitem = new TreeItem(tree, SWT.NONE);
		trtmNewTreeitem.setText("New TreeItem");
		
		TreeItem trtmNewTreeitem_2 = new TreeItem(trtmNewTreeitem, SWT.NONE);
		trtmNewTreeitem_2.setText("New TreeItem");
		
		TreeItem trtmNewTreeitem_1 = new TreeItem(trtmNewTreeitem, SWT.NONE);
		trtmNewTreeitem_1.setText("New TreeItem");
		trtmNewTreeitem.setExpanded(true);
		
		table = new Table(sashForm, SWT.BORDER | SWT.FULL_SELECTION);
		table.addMouseListener(new MouseAdapter() {
			@Override
			public void mouseDoubleClick(MouseEvent e) {
				int selectLength = table.getSelection().length;
				if (selectLength > 0){
					new ImageViewDialog(parent.getShell(), SWT.APPLICATION_MODAL|SWT.DIALOG_TRIM).open();
				}
			}
		});
		table.setHeaderVisible(true);
		table.setLinesVisible(true);
		
		TableColumn tblclmnNewColumn = new TableColumn(table, SWT.NONE);
		tblclmnNewColumn.setWidth(268);
		tblclmnNewColumn.setText("\uC774\uB984");
		
		TableColumn tblclmnNewColumn_1 = new TableColumn(table, SWT.NONE);
		tblclmnNewColumn_1.setWidth(172);
		tblclmnNewColumn_1.setText("\uB0A0\uC9DC");
		
		TableColumn tblclmnNewColumn_2 = new TableColumn(table, SWT.NONE);
		tblclmnNewColumn_2.setWidth(123);
		tblclmnNewColumn_2.setText("\uC720\uD615");
		
		TableColumn tblclmnNewColumn_3 = new TableColumn(table, SWT.NONE);
		tblclmnNewColumn_3.setWidth(100);
		tblclmnNewColumn_3.setText("\uD06C\uAE30");
		
		TableItem tableItem = new TableItem(table, SWT.NONE);
		tableItem.setImage(SWTResourceManager.getImage(DetailStatusDirectoryInformationComposite.class, "/com/famfamfam/slik/icons/images.png"));
		tableItem.setText(new String[] {"20130219132701_008_01_\uCDA9\uB0A880\uC5441587.jpg", "2013-02-19 \uC624\uD6C4 1:27:01", "JPG \uC774\uBBF8\uC9C0", "42KB"});
		sashForm.setWeights(new int[] {1, 3});

	}

	@Override
	protected void checkSubclass() {
		// Disable the check that prevents subclassing of SWT components
	}
}
